import Vue from 'vue'
import Router from 'vue-router'
const index= () => import('@/views/index');
const login= () => import('@/views/login');
const dashborad=() => import('@/views/home/dashboard');

const projectManage=() => import('@/views/system/project')
const roleManage=() => import('@/views/system/role')
const userManage=() => import('@/views/system/user')

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'login',
      component: login,
      meta: {
        requireAuth: false
      }
    },
    {
      path: '/login',
      name: 'login',
      component: login,
      meta: {
        requireAuth: false
      },
    },
    {
      path: '/index',
      name: 'index',
      component: index,
      meta: {
        requireAuth: true
      },
      children: [
        {
          path: '/home/dashboard',
          name: 'dashboard',
          component: dashborad,
          meta: {
            requireAuth: true,
            permission: null
          }
        },
        {
          path: '/system/projectManage',
          name: 'projectManage',
          component: projectManage,
          meta: {
            requireAuth: true,
            permission: "PROJECT_MENU"
          }
        },
        {
          path: '/system/roleManage',
          name: 'roleManage',
          component: roleManage,
          meta: {
            requireAuth: true,
            permission: "ROLE_MENU"
          }
        },
        {
          path: '/system/userManage',
          name: 'userManage',
          component: userManage,
          meta: {
            requireAuth: true,
            permission: "USER_MENU"
          }
        }
      ]
    },
  ]
})
